<template>
  <div>
    <h1>微博绑定用户页面</h1>
    <van-cell-group>
      <van-field
        v-model="mobile"
        required
        label="文本"
        placeholder="请输入手机号"
      />
    </van-cell-group>
    <van-button @click="choseusertype">我是雇主</van-button>
    <van-button @click="choseusertype1">我是服务商</van-button> <br />
    <van-button type="primary" @click="submit">提交</van-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      mobile: "",
      vtoken: this.$route.query.token,
      vuid: this.$route.query.uid,
      user_type: "",
    };
  },
  methods: {
    submit() {
      this.axios
        .post("/bduser", {
          mobile: this.mobile,
          vtoken: this.vtoken,
          vuid: this.vuid,
          user_type: this.user_type,
        })
        .then((res) => {
          console.log(res);
          if (res.data.code == 200) {
            localStorage.setItem("vtoken", this.vtoken);
            localStorage.setItem("vuid", this.vuid);
            localStorage.setItem("token", res.data.token);
            localStorage.setItem("userid", res.data.userid);
            //   this.$router.push("/login");
            alert(res.data.msg);
          }
        });
    },
    choseusertype() {
      this.user_type = 1;
    },
    choseusertype1() {
      this.user_type = 2;
    },
  },
};
</script>

<style>
</style>